package top.healthylife.gateway.platform.br.api.api.basicdata;


import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.br.api.utils.GetmeltingTokenUtils;
import top.healthylife.gateway.platform.br.dto.basicdata.speciallistcv2.req.ByReqSpecialListcV2Dto;
import top.healthylife.gateway.platform.br.dto.basicdata.speciallistcv2.res.ByResSpecialListcV2Dto;

/**
 * @author cl
 * @version 1.0
 * @date 2020/4/23 10:00
 */
@Slf4j
@Service
@ApiServiceExplain( docUrl="https://account-self.100credit.com/", price = 20,apiName = "特殊名单验证2.0", info = "用户本人、联系人、与用户有亲密关系的人（一度关系、二度关系-百融关系库定义）是否疑似命中中风险、一般风险、资信不佳、拒绝、高风险等百融特殊名单，以及命中次数和命中距今时间，以识别个体是否有虚假申请、欺诈等风险")
public class SpecialListcV2Api implements ParentFace<ByReqSpecialListcV2Dto, ByResSpecialListcV2Dto> {
    /**
     * 接口唯一标识
     */
    static final String APIIDENTIFICATION = "SpecialList_c";

    /**
     * 接口版本号
     */
    static final String VESION = "2.0";

    @Override
    public ByResSpecialListcV2Dto execute(ByReqSpecialListcV2Dto brDemoApi){
        //访问百融获取数据
        String apiData = GetmeltingTokenUtils.getApiData(APIIDENTIFICATION, VESION
                , BeanUtil.beanToMap(brDemoApi), GetmeltingTokenUtils.systemConfigInfo(brDemoApi));
        return JSON.parseObject(apiData, ByResSpecialListcV2Dto.class);
    }
}
